let obj1 = {};
obj1.fn = () => {
    console.log(111)
}

let obj2 = {
    name: "222",
    fn: function () {
        console.log(this.name)
    }
}

let obj3 = {
    name: "zs"
}
let obj4 = {
    age: 18
}

let person = {...obj3, ...obj4};
let person2 = Object.assign({}, obj3, obj4)
// console.log(person)
// console.log(person2)

let obj5 = {}
obj5.name = 10

let var1 = obj5.name ?? 18
/*console.log(var1)*/

let obj6 = {}
// console.log(obj6.name?.firstName?.toUpperCase())


/*for (const key in person2) {
    console.log(key + ":" + person2[key])
}*/
/*Object.keys(person2).forEach(log)

function log(item) {
    console.log(item)
}*/

var propertyNames = Object.getOwnPropertyNames(person2);
// propertyNames.forEach(console.log)


const fn = function (n) {
    console.log(n)
}
const str = 'string'
const arr = [1, 2, 3]
const obj = {
    a: 123,
    b: 456
}
const num = 1
const b = true
const n = null
const u = undefined

function isTypeOf(data) {
    return Object.prototype.toString.call(data).replace(/\[object (\w+)\]/, '$1').toLowerCase();
}

let typeOf = isTypeOf([]);
// console.log(typeOf)

var array = new Array(100);
Object.keys(array).forEach(console.log);
/*for (let key of array.keys()) {
    console.log(key)
}*/
// Array.from(new Array(100).keys()).forEach(item => console.log(item))
// Array.from({length: 100}).map((item, index) => index).forEach(item => console.log(item))
// Array.from({length: 101}, (v, k) => k).forEach(item => console.log(item))

var s = Array.from({length: 101}, (v, index) => index).join(",");
// console.log(s)

// Object.values(person2).forEach(item => console.log(item))

console.log(Object.entries(person2));
let entries = Object.entries(person2);

console.log(Object.fromEntries(entries));

console.log(person2.hasOwnProperty("name"));
console.log(person2.hasOwnProperty("name2"));

const arr2 = ['a','b'];
Object.getOwnPropertyNames(arr2).forEach(item => console.log(item))
Object.keys(arr2).forEach(item => console.log(item))

